package com.cardone.platform.common.service;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;


import lombok.Getter;


import lombok.Setter;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.transaction.annotation.Transactional;

import com.cardone.common.dto.PaginationDto;
import com.cardone.common.cache.Caches;
import com.cardone.context.Attributes;
import com.cardone.context.ContextHolder;
import com.cardone.common.util.EntityUtils;
import com.cardone.platform.common.dao.EntityLogDao;
import com.cardone.platform.common.dto.EntityLogDto;

/**
 * 实体日志服务
 *
 * @author yaohaitao
 * 
 */
@Getter 
@Setter
@Transactional(readOnly = true)
public class EntityLogDefaultService implements EntityLogService {
	@Override
	@Transactional
	public <P> P saveByIdOrCode(Class<P> mappedClass, EntityLogDto saveEntityLog) {
		return ContextHolder.getBean(EntityLogDao.class).saveByIdOrCode(mappedClass, saveEntityLog);
	}
	
	@Override
	@Transactional
	public EntityLogDto saveByIdOrCode(EntityLogDto saveEntityLog) {
		return ContextHolder.getBean(EntityLogDao.class).saveByIdOrCode(EntityLogDto.class, saveEntityLog);
	}
	
	@Override
	public <P> P findByCodeOrId(Class<P> mappedClass, EntityLogDto findEntityLog) {
		return ContextHolder.getBean(EntityLogDao.class).findByCodeOrId(mappedClass, findEntityLog);
	}
	
	@Override
	public Integer readByCodeNqIdForCount(EntityLogDto readEntityLog) {
		return ContextHolder.getBean(EntityLogDao.class).readByCodeNqIdForCount(readEntityLog);
	}
	
	@Override
	@Transactional
	public int insertByCode(EntityLogDto insertEntityLog) {
		return ContextHolder.getBean(EntityLogDao.class).insertByCode(insertEntityLog);
	}
	
	@Override
	@Transactional
	public int updateByCode(EntityLogDto updateEntityLog) {
		return ContextHolder.getBean(EntityLogDao.class).updateByCode(updateEntityLog);
	}

	@Override
	@Transactional
	public int deleteByIds(EntityLogDto deleteEntityLog) {
		return ContextHolder.getBean(EntityLogDao.class).deleteByIds(deleteEntityLog);
	}

	@Override
	public <P> P findById(Class<P> mappedClass, EntityLogDto findEntityLog) {
		return ContextHolder.getBean(EntityLogDao.class).findById(mappedClass, findEntityLog);
	}

	@Override
	public <P> List<P> findListByLikeCode(Class<P> mappedClass, EntityLogDto findListEntityLog) {
		return ContextHolder.getBean(EntityLogDao.class).findListByLikeCode(mappedClass, findListEntityLog);
	}

	@Override
	public <P> List<P> findList(Class<P> mappedClass) {
		return ContextHolder.getBean(EntityLogDao.class).findList(mappedClass);
	}

	@Override
	public <P> PaginationDto<P> paginationByLikeCode(Class<P> mappedClass, EntityLogDto paginationEntityLog) {
		return ContextHolder.getBean(EntityLogDao.class).paginationByLikeCode(mappedClass, paginationEntityLog);
	}
}